package com.sd365.permission.centre.service;

import com.sd365.permission.centre.pojo.dto.DictionaryDTO;
import com.sd365.permission.centre.pojo.query.DictionaryQuery;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestBody;

import javax.validation.Valid;
import java.util.List;

/**
 * @class DictionaryService
 * @classdesc
 * @author Administrator
 * @date 2020-10-18  1759
 * @version 1.0.0
 * @see
 * @since
 */
public interface DictionaryService {


    /**
     * @param dictionaryDTO 客户DTO
     * @return 成功则true
     * @see
     * @since
     */
    Boolean add(@RequestBody @Valid DictionaryDTO dictionaryDTO);


    /**
     * @param
     * @return
     * @see
     * @since
     */
    Boolean remove(Long id, Long version);


    /**
     * @param
     * @return
     * @see
     * @since
     */
    Boolean modify(DictionaryDTO dictionaryDTO);

    /**
     * @param
     * @return
     *  批量更新字典记录
     * @param DictionaryDTOS
     * @return
     */
    @Transactional
    Boolean batchUpdate(DictionaryDTO[] dictionaryDTOS);

    /**
     * 批量删除字典记录
     * @param dictionaryDTOS
     * @return
     */
    @Transactional
    Boolean batchRemove(DictionaryDTO[] dictionaryDTOS);

    /**
     * @param:
     * @return:
     * @see
     * @since
     */
    List<DictionaryDTO> commonQuery(DictionaryQuery dictionaryQuery);

    /**
     * @param id 客户id
     * @return DictionaryDTO
     * @see
     * @since
     */
    @Cacheable(cacheNames = "dictionary",key ="#id")
    DictionaryDTO queryById(Long id);


    /**
     * @param id 客户id
     * @return DictionaryDTO
     * @see
     * @since
     */
    @Cacheable(cacheNames = "dictionary",key ="#id")
    List<DictionaryDTO> queryByTypeId(Long id);



}
